package test;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;

public class Utils {
	public static String getContent(String url) throws Exception {
		URL url2 = new URL(url);

		InputStream in = (InputStream)url2.getContent();

		return stringFromInputStream(in);
	}

	public static String stringFromInputStream(InputStream ins) throws Exception {
		ByteArrayOutputStream buf = new ByteArrayOutputStream();
		int b;
		while((b = ins.read()) != -1){
			buf.write(b);
		}
		
		return new String(buf.toByteArray());
	}
}
